<template>
  <div class="mySearchInput">
    <div class="input-block">
      <input type="text" @input="onInput" :placeholder="placeholder" />
    </div>
    <div class="icon-block" @click="search">
      <div class="iconfont icon">&#xe66e;</div>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    value: {},
    placeholder: {},
    btnBgc: {
      default: "",
    },
  },
  mounted() {},
  methods: {
    onInput(e) {
      this.$emit("update:value", e.target.value);
    },
    search() {
      this.$emit("search");
    },
  },
};
</script>

<style lang="less" scoped>
.mySearchInput {
  display: flex;
  align-items: center;
  width: 222px;
  height: 100%;
  .input-block {
    width: 82%;
    height: 100%;
    input {
      width: 100%;
      height: 100%;
      outline: none;
      border: none;
      border: 1px solid #e7e7e7;
      border-right: none;
      border-top-left-radius: 18px;
      border-bottom-left-radius: 18px;
      padding: 0 15px;
      box-sizing: border-box;
      font-size: 14px;
    }
  }
  .icon-block {
    position: relative;
    width: 18%;
    height: 100%;
    border-top-right-radius: 18px;
    border-bottom-right-radius: 18px;
    border-left: none;
    cursor: pointer;
    user-select: none;
    color: #fff;
    background-color: #DBDBDB;

    &:hover {
      opacity: 0.65;
    }
    .icon {
      position: absolute;
      left: 50%;
      top: 50%;
      transform: translate(-50%, -50%);
      font-size: 14px;
      font-weight: bold;
    }
  }
}
</style>